https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/submissions/
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
maxLengh = 0
nowStr = ''
index = 0
indexFlag = 0
while index < len(s):
if nowStr == '':
nowStr = s[index]
indexFlag = index
else:
if s[index] in nowStr:
nowStr = ''
#从上次开始计算的下一个继续开始判断
index = indexFlag
else:
nowStr += s[index]
if len(nowStr) > maxLengh:
maxLengh = len(nowStr)
index += 1
return maxLengh